package com.sky.config;

import com.sky.properties.HuaWeiOBSProperties;
import com.sky.utils.HuaWeiObsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类 用于创建OBSUtil对象
 */
@Configuration
@Slf4j
public class ObsConfiguration {
    @Bean
    @ConditionalOnMissingBean
    public HuaWeiObsUtil huaWeiObsUtil(HuaWeiOBSProperties huaWeiOBSProperties){
        log.info("开始创建华为云OBS工具类对象：{}" ,huaWeiOBSProperties);
       return new HuaWeiObsUtil(huaWeiOBSProperties.getAk(), huaWeiOBSProperties.getSk(), huaWeiOBSProperties.getEndPoint(), huaWeiOBSProperties.getBucketname());
    }
}
